Samba file sharing

Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.


Overview

Samba is a commonly used tool for building file sharing and access control services on Linux systems. It uses the SMB protocol to enable file access between different devices within a local area network. By deploying Samba locally, you can easily provide shared directories to Windows, Linux, or macOS clients, enabling cross-platform file transfer and collaboration.

This document describes how to configure a Samba file sharing service on the Quectel Pi M2 Debian system so that a Windows computer can directly access the device’s shared folders.

Prerequisites

  1. Confirm the device environment:

    • Quectel Pi M2 has booted into the Debian system

    • The Windows host and the device are on the same local area network with working network connectivity

    • M2 is verified under the GNOME graphical environment. Samba file sharing does not depend on the GNOME desktop.

  2. Check network connectivity.Run the following command on the device to view the current IP address:

hostname -I
ping <board-IP>

Install Samba Service

Samba is a service program on Debian/Linux used for sharing files with Windows systems.

  1. Update the package list:

sudo apt-get update
  1. Install Samba and client tools:

sudo apt-get install -y samba smbclient

💡 samba: Server-side software for providing sharing services; smbclient: Client tool that can be used to test whether the connection is successful.

  1. Confirm that Samba is installed successfully:

smbd --version
smbclient --version

Create a Shared Folder

💡 This document uses the user q as an example to illustrate Samba sharing configuration. If this user does not yet exist in the system, you can use an existing user (such as root), or create a regular user first before proceeding with the configuration.

  1. Create a shared directory:

mkdir -p /home/q/share
  1. Create a test file:

touch /home/q/share/test.txt
  1. Modify permissions:

sudo chown -R q:q /home/q/share
chmod -R 775 /home/q/share

Configure Samba Service

  1. Open the configuration file:

sudo vim /etc/samba/smb.conf
sudo nano /etc/samba/smb.conf
  1. Scroll to the end of the file and add the following content:

[myshare]
comment = My Shared Folder
browseable = yes
path = /home/q/share
create mask = 0664
directory mask = 0775
valid users = q
force user = q
force group = q
public = no
guest ok = no
writable = yes
available = yes

💡 [myshare] — The share name seen by Windows clients when accessing. path — The actual path of the shared directory. create mask / directory mask — Default permissions for newly created files/folders. valid users — Authorized users allowed to access the Samba server; the example user here is q; in actual use, replace it with the real user on the development board. writable = yes — Allows clients to create, modify, and delete files in this directory.

💡 If you need to allow anonymous access, use public = yes; if you need to prevent anonymous/guest access, keep public = no, guest ok = no.

  1. Check the Samba configuration file syntax:

testparm

Set Samba User and Password

The Samba login user must be an existing user in the system and requires a separate Samba access password. Using the system user q as an example:

sudo smbpasswd -a q

You will need to enter the password twice for confirmation (this password will be used when accessing from Windows).

Restart Samba Service to Apply Configuration

sudo systemctl restart smbd
sudo systemctl status smbd --no-pager -l

Set Samba to start automatically on boot:

sudo systemctl enable smbd

Check Port Listening

Samba primarily uses TCP port 445. After the service starts, run the following command to confirm whether the port is in a listening state:

ss -tulnp | grep -E ':445|:139'

If the device has a firewall enabled, allow TCP port 445 according to your actual firewall tool. When no firewall is enabled, no additional rules are needed.

View Device IP Address

Before accessing the device’s shared directory from Windows, you need to obtain the device IP address:

hostname -I

In actual use, use the IP address currently queried on the development board.

Access Device Shared Folder from Windows Computer

  1. Run the following command on the Quectel Pi M2 device to obtain the development board IP address:

hostname -I
  1. Open Command Prompt on the Windows host and run the following commands to connect to the shared directory:

net use \\<board-IP>\myshare /delete
net use \\<board-IP>\myshare /user:q
explorer \\<board-IP>\myshare
  1. After successful access, you will see the previously created test file test.txt.

💡 If Windows reports that access is not possible, first run ping <board-IP> to confirm network reachability. If credentials conflict, delete the device-related credentials in the Windows “Credential Manager” and reconnect.

Access Windows Shared Folder from the Device

In addition to accessing the device’s shared directory from a Windows computer, you can also reverse access a shared folder on a Windows computer from the device.

Create a Shared Directory on Windows

  1. Create a new folder for sharing on the Windows computer, for example:

device_share
  1. Right-click the folder and select “Properties” → “Sharing” → “Advanced Sharing”.

  2. Check “Share this folder” and set the share name to:

m2_share
  1. Click “Permissions” and add read or write permissions for the Windows users who need to access this shared directory.

  2. Switch to the “Security” tab and confirm that the Windows user also has the corresponding read or write permissions in NTFS permissions.

💡 Windows sharing permissions and “Security” permissions must both allow access; otherwise, the device side may be able to see the share name but cannot enter the directory or create files.

Confirm Network and Firewall on Windows

  1. Confirm that the Windows computer and the device are on the same reachable network.

  2. Enable the following in Windows “Advanced sharing settings”:

    • Network discovery

    • File and printer sharing

  3. Confirm that the Windows firewall allows “File and Printer Sharing (SMB-In)”.

Check Connectivity from the Device

Run the following commands in the device terminal to confirm that the Windows host’s SMB service port is accessible (replace <Windows-host-IP> with the actual IP):

# View the device's current IP address
hostname -I

# Test network connectivity to Windows host
ping -c 3 <Windows-host-IP>

# Test SMB port connectivity
timeout 3 bash -c 'cat < /dev/null > /dev/tcp/<Windows-host-IP>/445' && echo 445_open || echo 445_failed
timeout 3 bash -c 'cat < /dev/null > /dev/tcp/<Windows-host-IP>/139' && echo 139_open || echo 139_failed

If the output shows 445_open or 139_open, the device can reach the Windows SMB service port.

Access from Device via Command Line

Use smbclient to view the list of shares on the Windows host:

smbclient -L //<Windows-host-IP> -U 'DOMAIN\username'

Enter the Windows user’s login password when prompted. If authentication succeeds, you can see the shared directory names in the output, for example:

m2_share        Disk

Access a specified shared directory and list files:

smbclient //<Windows-host-IP>/<share-name> -U 'DOMAIN\username' -c 'ls'

This document confirms that the device can successfully list the Windows host’s shared list and enter the corresponding shared directory.

Access from Device via Graphical Interface

💡 This method is applicable to the GNOME graphical environment.

In the Quectel Pi M2 Debian graphical environment, you can access Windows shared directories through the file manager. Enter the following in the file manager address bar:

smb://<Windows-host-IP>/<share-name>

Then follow the on-screen prompts to enter the Windows username, domain or workgroup, and password to access the shared directory.